package com.tdkj.action.common;

import java.util.List;

import javax.annotation.Resource;

import com.tdkj.action.BaseAction;
import com.tdkj.model.common.BeanType;
import com.tdkj.service.common.IBeanTypeService;


public class TypeAction extends BaseAction {
    
	private IBeanTypeService goodTypeService;
	
	
	private Long id;
	private Long parentId;
	private String name;
	
	private BeanType goodType ;
	private List<BeanType> goodTypes ;
	
	public String add() {
		goodTypeService.createType(parentId, name);
		return execute();
	}
	
	public String update() {
		goodTypeService.updateType(id, parentId, name);
		return edit();
	}

	public String del() {
		goodTypeService.deleteType(id);
		return execute();
	}
	
	public String edit() {
		goodType = goodTypeService.findById(id, BeanType.class);
		return "edit";
	}
	
	public String execute() {
		return "success";
	}

	/**
	 * @return the id
	 */
	public Long getId() {
		return id;
	}

	/**
	 * @param id the id to set
	 */
	public void setId(Long id) {
		this.id = id;
	}

	/**
	 * @return the parentId
	 */
	public Long getParentId() {
		return parentId;
	}

	/**
	 * @param parentId the parentId to set
	 */
	public void setParentId(Long parentId) {
		this.parentId = parentId;
	}

	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * @param name the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * @return the goodType
	 */
	public BeanType getGoodType() {
		return goodType;
	}

	/**
	 * @param goodType the goodType to set
	 */
	public void setGoodType(BeanType goodType) {
		this.goodType = goodType;
	}

	/**
	 * @return the goodTypes
	 */
	public List<BeanType> getGoodTypes() {
		return goodTypes;
	}

	/**
	 * @param goodTypes the goodTypes to set
	 */
	public void setGoodTypes(List<BeanType> goodTypes) {
		this.goodTypes = goodTypes;
	}

	/**
	 * @param goodTypeService the goodTypeService to set
	 */
	@Resource
	public void setGoodTypeService(IBeanTypeService goodTypeService) {
		this.goodTypeService = goodTypeService;
	}



}
